package com.ydl.learning.flink.demo.transformations

import com.ydl.learning.flink.demo.Utils
import org.apache.flink.api.java.aggregation.Aggregations
import org.apache.flink.api.scala._

/**
 * aggregate
 * 聚合计算用的，只能用在DataSet
 * 只支持Aggregations的几个枚举类型 sum max min
 *
 * @author ydl
 * @since 2020/9/23
 */
object AggregateDemo extends App with Utils {

  val input: DataSet[(Int, String, Double)] = env.fromCollection(dataDemo)
  val output = input.groupBy(1).aggregate(Aggregations.SUM, 0).and(Aggregations.MIN, 2)
  output.print()

}
